package com.kws.merchant.controller;


import com.kws.merchant.domain.ContractTemplate;
import com.kws.merchant.domain.po.ContractTemplatePo;
import com.kws.system.api.domain.TemplatePo;
import com.kws.merchant.service.ContractTemplateService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import com.kws.common.core.domain.R;

import javax.annotation.Resource;
import java.util.List;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.web.multipart.MultipartFile;

/**
 * 合同管理-模板(ContractTemplate)表控制层
 *
 * @author yxy
 * @since 2024-10-29 15:37:32
 */
@RestController
@Api(tags = "合同管理-模板(ContractTemplate)")
@RequestMapping("contractTemplate")
public class ContractTemplateController {
    /**
     * 服务对象
     */
    @Resource
    private ContractTemplateService contractTemplateService;
 
    @PostMapping("/page")
    @ApiOperation(value = "分页查询列表")
    public R<Page<ContractTemplate>> pageList(@RequestBody ContractTemplatePo contractTemplatePo){
        return R.ok(contractTemplateService.pageList(contractTemplatePo));
    }

    @GetMapping("/detailById/{id}")
    @ApiOperation(value = "通过主键查询单条数据")
    public R<ContractTemplate> detailById(@PathVariable Long id) {
        return R.ok(contractTemplateService.getById(id));
    }


    @PostMapping("/addTemplate")
    @ApiOperation(value = "新增合同模板")
    public R addTemplate(@ModelAttribute TemplatePo templatePo) {
        return R.ok(contractTemplateService.addTemplate(templatePo));
    }
   /* @PostMapping("/updateContract")
    @ApiOperation(value = "修改合同")
    public R update(@RequestBody ContractTemplate contractTemplate) {
        return R.ok(contractTemplateService.updateContract(contractTemplate));
    }*/


    @PostMapping("/deleteById/{id}")
    @ApiOperation(value = "删除数据-这里传一个id删除")
    public R deleteById(@PathVariable Long id) {
        return R.ok(contractTemplateService.deleteById(id));
    }

    @GetMapping("/list")
    @ApiOperation(value = "查询商家合同模板列表")
    public R<List<ContractTemplate>> list() {
        return R.ok(contractTemplateService.list());
    }


}
